﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace Champ
{
    class ChooseCharacterScreen:Screen
    {
        //Function to draw everything visible to the players in this screen
        public override void DrawScreen(SpriteBatch spriteBatch, GameController game)
        {
            this.renderingRect = game.titleSafe;
            this.Draw(spriteBatch);
          
           
            if (game.player[0] != null)
            {
                game.player[0].Draw(spriteBatch);
                game.player[0].currentPlayerState = Player.playerState.creationOne;
                game.player[0].characterDisplayData(game.titleSafe, game.titleSafe);
                spriteBatch.Draw(game.buttonTextures[5], new Rectangle(110, 500, 30, 30), Color.White);
                DrawText(spriteBatch, new Vector2(180, 519), "Change", game.gameFont[5], Color.White); 
            }
            else
            {
                spriteBatch.Draw(game.buttonTextures[0], new Rectangle(120, 500, 30, 30), Color.White);
                DrawText(spriteBatch, new Vector2(180, 519), "Join", game.gameFont[5], Color.White); 
            }
            if (game.player[1] != null)
            {
                game.player[1].Draw(spriteBatch);
                game.player[1].currentPlayerState = Player.playerState.creationTwo;
                game.player[1].characterDisplayData(game.titleSafe, game.titleSafe);
                spriteBatch.Draw(game.buttonTextures[5], new Rectangle(260, 500, 30, 30), Color.White);
                DrawText(spriteBatch, new Vector2(330, 519), "Change", game.gameFont[5], Color.White);
            }
            else
            {
                spriteBatch.Draw(game.buttonTextures[0], new Rectangle(270, 500, 30, 30), Color.White);
                DrawText(spriteBatch, new Vector2(330, 519), "Join", game.gameFont[5], Color.White);
            }
            if (game.player[2] != null)
            {
                game.player[2].Draw(spriteBatch);
                game.player[2].currentPlayerState = Player.playerState.creationThree;
                game.player[2].characterDisplayData(game.titleSafe, game.titleSafe);
                spriteBatch.Draw(game.buttonTextures[5], new Rectangle(420, 500, 30, 30), Color.White);
                DrawText(spriteBatch, new Vector2(490, 519), "Change", game.gameFont[5], Color.White);
            }
            else
            {
                spriteBatch.Draw(game.buttonTextures[0], new Rectangle(430, 500, 30, 30), Color.White);
                DrawText(spriteBatch, new Vector2(490, 519), "Join", game.gameFont[5], Color.White);
            }
            if (game.player[3] != null)
            {
                game.player[3].Draw(spriteBatch);
                game.player[3].currentPlayerState = Player.playerState.creationFour;
                game.player[3].characterDisplayData(game.titleSafe, game.titleSafe);
                spriteBatch.Draw(game.buttonTextures[5], new Rectangle(590, 500, 30, 30), Color.White);
                DrawText(spriteBatch, new Vector2(660, 519), "Change", game.gameFont[5], Color.White);
            }
            else
            {
                spriteBatch.Draw(game.buttonTextures[0], new Rectangle(600, 500, 30, 30), Color.White);
                DrawText(spriteBatch, new Vector2(660, 519), "Join", game.gameFont[5], Color.White);
            }
            if (game.player[0] != null || game.player[1] != null || game.player[2] != null || game.player[3] != null)
            {
                spriteBatch.Draw(game.buttonTextures[4], new Rectangle(310, 550, 30, 30), Color.White);
                DrawText(spriteBatch, new Vector2(410, 573), "Start Game", game.gameFont[5], Color.White);
            }
        
        }  

    }
}
